import static org.junit.Assert.*;
import models.Entities;
import models.EntityRelation;
import models.IdeaDeveloper;
import models.Organization;
import models.OrganizationLead;
import models.Topic;
import models.TopicRelation;

import org.junit.Test;

import play.test.UnitTest;

import controllers.Application;


public class Badawy extends UnitTest{
	@Test
	public void addTopicRelation() {
		IdeaDeveloper ideaDeveloper1 = new IdeaDeveloper("AmiraAli ",
				"Amira Elshimy", "123456", "amira@guc.edu.eg", "17/8/1991",
				"lalal");
		ideaDeveloper1.save();
		Organization org1 = new Organization();
		org1.save();
		OrganizationLead orgLead1 = OrganizationLead.create(ideaDeveloper1);
		org1.creator = orgLead1;
		org1.save();
		Topic topic1 = Topic.createTopicOrg("yarab", "yamosahel", org1.id,
				ideaDeveloper1.id);
		Topic topic2 = Topic.createTopicOrg("aaa", "ss", org1.id,
				ideaDeveloper1.id);
		assertEquals("Relation is done !",
				TopicRelation.MakeTopicRelation(topic1.id, topic2.id, "manges","sadasd"));

	}
	@Test
	public void removeTopicRelation() {
		IdeaDeveloper ideaDeveloper1 = new IdeaDeveloper("AmiraAli ",
				"Amira Elshimy", "123456", "amira@guc.edu.eg", "17/8/1991",
				"lalal");
		ideaDeveloper1.save();
		Organization org1 = new Organization();
		org1.save();
		OrganizationLead orgLead1 = OrganizationLead.create(ideaDeveloper1);
		org1.creator = orgLead1;
		org1.save();
		Topic topic1 = Topic.createTopicOrg("yarab", "yamosahel", org1.id,
				ideaDeveloper1.id);
		Topic topic2 = Topic.createTopicOrg("aaa", "ss", org1.id,
				ideaDeveloper1.id);
		
		//TopicRelation.MakeTopicRelation(topic1.id, topic2.id, "manges","sadasd");
		TopicRelation temp =
			new TopicRelation();
		temp.firstTopic=topic1.id;
		temp.secondTopic=topic2.id;
		temp.relationName="mmm";
		temp.description="sdadsasd";
		temp.save();
		
		
		assertEquals("Deleted!",
				TopicRelation.DelteRelationsTopics(temp.id));

	}
	@Test
	public void addEntityRelation() {
		IdeaDeveloper ideaDeveloper1 = new IdeaDeveloper("AmiraAli ",
				"Amira Elshimy", "123456", "amira@guc.edu.eg", "17/8/1991",
				"lalal");
		ideaDeveloper1.save();
		Organization org1 = new Organization();
		org1.save();
		OrganizationLead orgLead1 = OrganizationLead.create(ideaDeveloper1);
		org1.creator = orgLead1;
		org1.save();
		Entities ent1 = Entities.create(org1);
		Entities ent2 = Entities.create(org1);
		
		assertEquals("Relation is done !",
				EntityRelation.MakeEntityRelation(ent1.id, ent2.id, "manges","sadasd"));

	}
	@Test
	public void removeEntityRelation() {
		IdeaDeveloper ideaDeveloper1 = new IdeaDeveloper("AmiraAli ",
				"Amira Elshimy", "123456", "amira@guc.edu.eg", "17/8/1991",
				"lalal");
		ideaDeveloper1.save();
		Organization org1 = new Organization();
		org1.save();
		OrganizationLead orgLead1 = OrganizationLead.create(ideaDeveloper1);
		org1.creator = orgLead1;
		org1.save();
		Entities ent1 = Entities.create(org1);
		Entities ent2 = Entities.create(org1);
		
		
		EntityRelation temp =
			new EntityRelation();
		temp.firstEntity=ent1.id;
		temp.secondEntity=ent2.id;
		temp.relationName="mmm";
		temp.description="sdadsasd";
		temp.save();
		
		
		assertEquals("Deleted!",
				EntityRelation.DelteRelationsEntity(temp.id));

	}
	
	
	
	
	
	
}
